package com.woniu.learnasync.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

/**
 * created by woniu201
 * created in 2018/7/6
 */
@RestController
public class TestController {

    @Autowired
    private Task task;

    @RequestMapping(value = "/test1", method = RequestMethod.GET)
    public String test1() throws InterruptedException {
        long t1 = System.currentTimeMillis();
        task.task1();
        long t2 = System.currentTimeMillis();

        return UUID.randomUUID().toString() + ",耗时：" + String.valueOf(t2-t1);
    }


}
